import java.util.LinkedList;
import java.util.List;

/**
 * @author xizizzz
 * @description: TODO
 * @date 2021-9-10上午 08:27
 */
public class A {
    static List<Integer> list = new LinkedList<>();

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            list.add(i);
        }
        for (int i = 0; i < 10; i++) {
            new Thread(new RunnableA()).start();
        }
    }

    static class RunnableA implements Runnable {
        @Override
        public void run() {
            while (true) {
                if (list.size() > 0) {
                    System.out.println(list.remove(0));
                }
            }
        }
    }
}
